/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unirio.ticketnator.helper;

import java.util.Date;


/**
 *
 * @author adm.Frade
 */
public class Token {
    public static final String key = "JUNINHOEREI";
    public static String Create(String username){
        Date d = new Date();
        username = username + d.getDay()+d.getMonth()+d.getYear()+key;
        return String.valueOf(username.hashCode());
    }
    public static boolean Validate(String username,String hash){
        Date d = new Date();
        username = username + d.getDay()+d.getMonth()+d.getYear()+key;
        return String.valueOf(username.hashCode()).equals(hash);
    }
}
